import javax.swing.JPanel;
import javax.swing.Timer;
import javax.imageio.ImageIO;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.List;

public class SquareZone extends JPanel implements ActionListener {

	List<Drawable> items;

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public Image background;

	Panda p;

	public SquareZone(Panda p) {
		this.p = p;
		this.setFocusable(true);
		this.setDoubleBuffered(true);
		try {
			background = ImageIO.read(new File("Holly_River_Waterfall.jpg"));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Timer time = new Timer(50, this);
		time.start();

	}

	public void paint(Graphics gs) {
		super.paint(gs);

		Graphics2D g = (Graphics2D) gs;
		g.drawImage(this.background, 0, 0, 1200, 800, this);
		p.display(g, this);

	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		this.repaint();
		p.update();
	}

}
